import 'package:flutter/material.dart';

class CustomRoute extends StatefulWidget {

  final String title;

  CustomRoute({Key key, this.title}) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _CustomRouteState();
  }

}

class _CustomRouteState extends State<CustomRoute> {

  void toggle() {
    Navigator.push(context, PageRouteBuilder(
        opaque: false,
        pageBuilder: (BuildContext context, _, __) {
          return Center(child: Text('My PageRoute'));
        },
        transitionsBuilder: (___, Animation<double> animation, ____,
            Widget child) {
          return FadeTransition(
            opacity: animation,
            child: RotationTransition(
              turns: Tween<double>(begin: 0.5, end: 1.0).animate(animation),
              child: child,
            ),
          );
        }
    ));
  }


  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new  Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: new RaisedButton(onPressed: toggle,
        child: new Text('自定义路由'),),
    );
  }

}